Skip to content

Add Explain View run reports and RPG visualizer#84

Open
QingtaoLi1 wants to merge 24 commits into
mainfrom
dev/rpg_visualization
Open

Add Explain View run reports and RPG visualizer#84
QingtaoLi1 wants to merge 24 commits into
mainfrom
dev/rpg_visualization

Conversation

@QingtaoLi1

Copy link
Copy Markdown
Contributor

Summary

Adds a shared Explain View run-report system for CoderMind commands, a new
RPG visualizer, and a batch of rpg_edit / git-workspace correctness fixes.

What's included

Explain View run reports (new)

  • scripts/common/run_events.py — structured event contract for command runs
  • scripts/common/run_report.py — shared sanitized HTML report renderer
    (write_command_report())
  • Wired into plan.py, update_graphs.py, and rpg_edit/review.py
  • Tests: test_run_report.py, test_rpg_edit_run_report.py

RPG visualization (new)

  • scripts/rpg_visualize.py — interactive D3 visualizer rendering three views
    (Feat Graph tree, collapsible Dep Graph, and Feat↔Dep Mapping)

rpg_edit improvements

  • Structured event contract emitted from the run
  • New RPG_EDIT_APPLY_RESULT_FILE output alongside RPG_EDIT_PLAN_FILE
  • Extended review report publishing
  • Clears stale/recovered sub-agent errors so successful runs no longer surface
    earlier timeouts

git / workspace correctness

  • git_utils: subdirectory-workspace-aware diffs and diff-range helpers
  • update_rpg: worktree comparisons aligned to the cmind workspace root
    (fixes duplicated RPG nodes from subdirectory workspaces)
  • update_rpg report now uses actual output fields + raw git delta counts

Bug fixes

  • dep_graph: missing property
  • graph search: handle list-valued RPG meta.path entries (no longer crashes on
    feature/all scope)
  • GitRunner: fix main_branch init parameter; merge to base branch, not main
  • smoke test: package-aware imports + explicit no-op backend methods to stop
    false stub detection

Test plan

  • uv run pytest CoderMind/tests/test_run_report.py
  • uv run pytest CoderMind/tests/test_rpg_edit_run_report.py
  • uv run pytest CoderMind/tests/test_encode_commands.py CoderMind/tests/test_encoder_workspace_layout.py
  • uv run pytest CoderMind/tests/test_sync_from_commit_diff.py CoderMind/tests/test_rpg_evolution.py
  • Generate a visualization: uv run python CoderMind/scripts/rpg_visualize.py rpg.json -o out.html

QingtaoLi1 and others added 18 commits June 30, 2026 05:52
Align update-rpg worktree comparisons and git diff outputs to the cmind workspace root so subdirectory workspaces do not duplicate RPG nodes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Report update_rpg results using the actual output fields, include raw git delta counts, and propagate semantic diff summaries so Explain View no longer shows zero/empty values for changed files and graph node counts.
Use package-aware imports for llm_usage_count_coarse and make intentional no-op/unsupported backend methods explicit so smoke stub detection no longer flags valid code.
Normalize list-valued feature paths before searching so search_rpg with feature/all scope no longer crashes when RPG nodes map to multiple paths. Add regression coverage for list-valued meta.path entries.
Clear stale sub-agent errors once a later iteration completes so successful rpg_edit reports do not surface recovered timeouts.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a shared “Explain View” HTML run-report system for multiple CoderMind commands, adds an RPG-focused HTML visualizer (including focused subgraph rendering), and improves git/workspace correctness for subdirectory workspaces (plus related rpg_edit and update_rpg wiring).

Changes:

  • Add structured run event types + a sanitized HTML report renderer, then wire reporting into several commands (plan/update_graphs/code_gen/rpg_edit).
  • Add/extend RPG visualization utilities, including generating focused subgraph HTML artifacts for reports.
  • Fix subdirectory workspace git diff/path handling and propagate diff summary outputs through update_rpg reporting/tests.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CoderMind/utils/claude/llm_usage_count_coarse.py Makes imports work both as a package module and as a standalone script.
CoderMind/tests/test_sync_from_commit_diff.py Adds coverage for workspace-relative diff helper paths in subdir workspaces.
CoderMind/tests/test_run_report.py New tests validating HTML escaping, sections, and rendering behaviors for Explain View reports.
CoderMind/tests/test_rpg_evolution.py Asserts diff summary/file lists are stored on RPGEvolution output.
CoderMind/tests/test_rpg_edit_run_report.py New tests for rpg_edit artifact persistence and review report publishing behavior.
CoderMind/tests/test_encoder_workspace_layout.py Adds fixtures/tests for workspaces inside a git repo and update_rpg path prefix handling.
CoderMind/tests/test_encode_commands.py Adds tests for meta git reads, diff summary return wiring, and list-valued meta.path search behavior.
CoderMind/templates/commands/rpg_edit.md Updates rpg_edit template to merge back into the user’s base branch (not assumed main).
CoderMind/scripts/update_graphs.py Wires Explain View reporting into update-rpg/sync flows and fixes worktree/subdir comparisons.
CoderMind/scripts/smoke_test.py Extends PYTHONPATH setup to include scripts/ for package-aware imports during smoke tests.
CoderMind/scripts/run_batch.py Adds Explain View batch report generation and prints report path in CLI output.
CoderMind/scripts/rpg/graph_query.py Handles list-valued RPG meta.path entries during search (prevents crashes).
CoderMind/scripts/rpg/dep_graph.py Adds missing derived field rpg_nodes to dep_graph derived field set.
CoderMind/scripts/rpg_visualize.py Adds focused-graph extraction/filtering and focused HTML generation helpers.
CoderMind/scripts/rpg_encoder/run_update_rpg.py Uses explicit cur_repo_dir for git meta reads; propagates diff summary/files into result.
CoderMind/scripts/rpg_encoder/run_encode.py Attaches Explain View reports to encode results (success/error) with artifacts and verification.
CoderMind/scripts/rpg_encoder/rpg_evolution.py Stores diff summary + diff file lists on RPG instances and returns diff_summary consistently.
CoderMind/scripts/rpg_edit/validate.py Persists validate results to a standard artifact path for downstream reporting.
CoderMind/scripts/rpg_edit/review.py Adds full Explain View report publishing for rpg_edit review (artifacts, deltas, focused graph).
CoderMind/scripts/rpg_edit/locate.py Persists locate results to a standard artifact path for downstream reporting.
CoderMind/scripts/rpg_edit/code.py Persists code-apply results and clears recovered sub-agent errors on successful completion.
CoderMind/scripts/rpg_edit/apply.py Persists apply results (including before_state/rollback hints) and records explicit confirmation.
CoderMind/scripts/plan.py Adds Explain View reporting for plan runs (check-only and full completion).
CoderMind/scripts/decoder_lang/python_backend.py Marks backend methods abstract to avoid being treated as no-op stubs.
CoderMind/scripts/common/utils.py Removes a redundant no-op __init__ implementation.
CoderMind/scripts/common/session_manager.py Makes NullSessionManager.before explicitly return None.
CoderMind/scripts/common/run_report.py New sanitized HTML report renderer shared across commands.
CoderMind/scripts/common/run_events.py New structured event dataclasses + normalization helpers for report payloads.
CoderMind/scripts/common/paths.py Adds standardized rpg_edit artifact file paths (validate/locate/apply).
CoderMind/scripts/common/git_utils.py Adds workspace-aware diff helpers, diff-range helpers, and git root prefix detection.
CoderMind/scripts/check_code_gen.py Adds Explain View report generation for code_gen progress status output.
CoderMind/pyproject.toml Bumps package version to 0.1.10.
CoderMind/.gitignore Ignores .claude/commands/ artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CoderMind/scripts/update_graphs.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated 9 comments.

Comment thread CoderMind/scripts/update_graphs.py Outdated
Comment thread CoderMind/scripts/update_graphs.py Outdated
Comment thread CoderMind/scripts/plan.py
Comment thread CoderMind/scripts/rpg_edit/apply.py
Comment thread CoderMind/scripts/decoder_lang/python_backend.py Outdated
Comment thread CoderMind/scripts/decoder_lang/python_backend.py Outdated
Comment thread CoderMind/scripts/decoder_lang/python_backend.py Outdated
Comment thread CoderMind/scripts/decoder_lang/python_backend.py Outdated
Comment thread CoderMind/scripts/decoder_lang/python_backend.py Outdated
@HuYaSen HuYaSen closed this Jul 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

zerorepo/rpg_gen/base/node/node.py:22

  • RepoNode is now an ABC with abstract is_file/is_dir, but DirectoryNode in this module only implements is_dir. This makes DirectoryNode abstract and instantiation (e.g. DirectoryNode(...) in skeleton/util helpers) will raise TypeError: Can't instantiate abstract class DirectoryNode with abstract method is_file at runtime.

Comment thread CoderMind/scripts/update_graphs.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants